/**
ParticleEmitter.hpp
Title: Particle Emitter Header File
Descr: ParticleEmitter Class

Copyright (c) 2010, Brant Ryan Anderson
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice,
      this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <ORGANIZATION> nor the names of its contributors
      may be used to endorse or promote products derived from this software
      without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/

#ifndef BINGE_PARTICLEEMITTER_HPP
#define BINGE_PARTICLEEMITTER_HPP

#include "../../binge/core/Timer.hpp"
#include "../../binge/objects/Sprite.hpp"
#include "../../binge/utilities/Vector3.hpp"

namespace binge
{

class ParticleEmitter
{
public:
	void setPosition(double x, double y) { position.Set(x,y,0); }
	void setPosition(Vector3 vec) { position = vec; }
	Vector3 getPosition() { return position; }
	void setDirection(double angle) { direction = angle; }
	double getDirection() { return direction; }
	void setMax(int num) { max = num; }
	void setAlphaRange(int min,int max);
	void setColorRange(int r1,int g1,int b1,int r2,int g2,int b2);
	void setSpread(int value) { spread = value; }
	void setLength(double value) { length = value; }
	void setVelocity(double value) { velocity = value; }
	float getScale(void) { return scale; }
	void setScale(float value) { scale = value; }

	ParticleEmitter();
	virtual ~ParticleEmitter();
	bool loadImage(std::string imageFile);
	void draw();
	void update();
	void add();

private:
	typedef std::vector<Sprite*>::iterator iter;
	std::vector<Sprite*> particles;
	Texture* image;
	Vector3 position;
	double direction;
	double length;
	int max;
	int alphaMin,alphaMax;
	int minR,minG,minB,maxR,maxG,maxB;
	int spread;
	double velocity;
	float scale;
};

} //namespace

#endif
